﻿
@{
    ViewBag.Title = "HiddenTroubleAdd";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}
@section css {
    <link href="~/Assets/css/lib/bootstrap-select.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/bootstrap-datetimepicker.min.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/fileinput.css" rel="stylesheet" />
    <style>
        th {
            text-align: center;
            font-weight: bold;
        }

        td {
            text-align: center;
            vertical-align: middle;
        }

        #location {
            position: absolute;
            z-index: 100;
            width: 10px;
            height: 10px;
            color: red;
            font-weight: bold;
        }

        .div-relative {
            position: relative;
        }

        .div-a {
            position: absolute;
        }
    </style>
}
<div class="page-content" ng-cloak ng-controller="HiddenTroubleController" ng-init="DataLoading=true;
     AddModel={};
     AddModel.CheckTime='@DateTime.Now.ToString("yyyy-MM-dd")';
     PageLoad();
     GetFactoryArea();
     GetSourceList(0);
     BindDepartmentList('Dep_Select');
     GetHiddenTroubleType();
     GetHiddenTroubleState();
     GetHiddenTroubleLevelList();
     AddModel.DepartmentId='0';
     SolutionModel=[];
     DataLoading=false;
     ">
    <div id="FormLoading" class="load">
        <div class="loader">
            <svg version="1.1" id="loader-1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
            <path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite" />
			</path>
		</svg>
            <div class="load-msg" ng-bind="LoadingMsg"></div>
        </div>
    </div>
    <div class="load" ng-hide="!Submiting" ng-show="Submiting">
        <div class="loader">
            <svg version="1.1" id="loader-1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
            <path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite" />
			</path>
		</svg>
            <div class="load-msg">正在提交...</div>
        </div>
    </div>
    <div class="page-heading">
        <h1>问题登记</h1>
        <div class="options">
            <div class="btn-toolbar">

            </div>
        </div>
    </div>
    <ol class="breadcrumb">
        <li><a>主页</a></li>
        <li><a>问题治理</a></li>
        <li class="active"><a>问题登记</a></li>
    </ol>
    <form id="HiddenTroubleForm" class="form-horizontal row-border">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="panel panel-inverse">
                        <div class="panel-heading"><h2>问题基本信息</h2></div>
                        <div class="panel-body">

                            <div class="form-group">
                                <label class="col-sm-1 control-label"><b style="color:red;">*</b>园区：</label>
                                <div class="col-sm-3">
                                    <select ng-model="AddModel.FactoryAreaId"  ng-change="GetPlaceList('placelist',AddModel.FactoryAreaId);" class="form-control">
                                        <option value="">请选择园区</option>
                                        <option ng-repeat="x in FactoryArea" value="{{x.Id}}">{{x.ParkName}}</option>
                                    </select>
                                </div>
                                <label class="col-sm-1 control-label"><b style="color:red;">*</b>责任部门：</label>
                                <div class="col-sm-3">
                                    <select id="Dep_Select" class="selectpicker show-tick form-control" ng-model="AddModel.DepartmentId" ng-change="GetEmployeeByDepartment(AddModel.DepartmentId);" data-live-search="true">
                                        <option value="0" selected>请选择责任部门</option>
                                    </select>
                                </div>
                                <label class="col-sm-1 control-label"><b style="color:red;">*</b>责任人：</label>
                                <div class="col-sm-3">
                                    <select ng-model="AddModel.ResponsibleEmloyeeNo" class="form-control">
                                        <option value="">请选择责任人</option>
                                        <option ng-repeat="x in EmployeeList" value="{{x.EmployeeNo}}">{{x.EmployeeNo}}-{{x.EmployeeName}}</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"><b style="color:red;">*</b>来源：</label>
                                <div class="col-sm-3" id="div_typeselect">
                                    <select ng-model="AddModel.SourceId" ng-change="" class="form-control">
                                        <option value="">请选择来源</option>
                                        <option ng-repeat="x in SourceList" value="{{x.Id}}">{{x.Source}}</option>
                                    </select>
                                </div>
                                <label class="col-sm-1 control-label"><b style="color:red;">*</b>问题分类：</label>
                                <div class="col-sm-3" id="div_typeselect">
                                    <select ng-model="AddModel.CategoryAreaId" ng-change="GetHiddenTroubleTypeChild(AddModel.CategoryAreaId,'div_typeselect');" class="form-control">
                                        <option value="">请选择问题分类</option>
                                        <option ng-repeat="x in CategoryList" value="{{x.Id}}">{{x.TypeName}}</option>
                                    </select>
                                </div>
                                <label class="col-sm-1 control-label"><b style="color:red;">*</b>问题子类：</label>
                                <div class="col-sm-3" id="div_typeselect">
                                    <select ng-model="AddModel.TypeId" class="form-control">
                                        <option value="">请选择问题子类</option>
                                        <option ng-repeat="x in CategoryChildList" value="{{x.Id}}">{{x.TypeName}}</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"><b style="color:red;">*</b>问题等级：</label>
                                <div class="col-sm-3">
                                    <select ng-model="AddModel.LevelId" class="form-control">
                                        <option value="">请选择问题等级</option>
                                        <option ng-repeat="x in LevelList" value="{{x.Id}}" title="{{x.Description}}">{{x.LevelName}}</option>
                                    </select>
                                </div>
                                <label class="col-sm-1 control-label"><b style="color:red;">*</b>检查时间：</label>
                                <div class="col-sm-3">
                                    <datepicker id="startTime" option="datetimeOption" format="L HH:mm" ng-model="AddModel.CheckTime"></datepicker>
                                </div>

                                <label class="col-sm-1 control-label">登记人：</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" placeholder="" ng-model="User.UserName" disabled />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">场所：</label>
                                <div class="col-sm-3">
                                    <select id="placelist" class="selectpicker show-tick form-control" ng-model="AddModel.PlaceId" ng-change="GetPlaceDepartment(AddModel.PlaceId,AddModel);" data-live-search="true">
                                        <option value="" selected>请选择场所</option>
                                    </select>
                                </div>
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>地点/部位：</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" placeholder="地点/部位" ng-model="AddModel.Location" />
                                </div>
                                <label class="col-sm-1 control-label">位置坐标：</label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" placeholder="X" ng-model="AddModel.X" readonly />
                                </div>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" placeholder="Y" ng-model="AddModel.Y" readonly />
                                </div>
                                <div class="col-sm-1">
                                    @*<a data-toggle="modal" href="#mapModal" class="btn btn-info">选择位置坐标</a>*@
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"><b style="color:red;">*</b>问题内容：</label>
                                <div class="col-sm-8">
                                    <textarea class="form-control autosize" ng-model="AddModel.Description" style="overflow-y:scroll; overflow-wrap: break-word; resize: horizontal; height: 80px;"></textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"><b style="color:red;">*</b>整改要求：</label>
                                <div class="col-sm-8">
                                    <textarea class="form-control autosize" ng-model="AddModel.Requirement" ng-init="AddModel.Requirement=''" style="overflow: hidden; overflow-wrap: break-word; resize: horizontal; height: 80px;"></textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">上传文件:</label>
                                <div class="col-lg-8">
                                    <input type="file" class="form-control" style="border:none;" id="hiddentroublefile" multiple>
                                </div>
                            </div>


                        </div>
                    </div>
                </div>
            </div>
            <div class="modal fade" id="mapModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog" style="min-width:985px;">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h2 class="modal-title">园区地图</h2>
                        </div>
                        <div class="modal-body">
                            <div class="div-relative" id="mapContent">
                                <div id="location" style="left:50%;top:50%;">
                                    <i class="fa fa-map-marker"></i>
                                </div>
                                <img src="~/Assets/img/web/longhua.jpg" width="950" ng-show="AddModel.FactoryAreaId==1" />
                                <img src="~/Assets/img/web/longhua.jpg" width="950" ng-show="AddModel.FactoryAreaId==2" />
                                <div ng-repeat="location in LocationList">
                                    <div class="div-a" ng-style="{'left':location.X+'%','top':location.Y+'%'}">
                                        <div style="font-size:12px; border-radius:4px;cursor:pointer;">
                                            <a class="titlediv" style="color:gainsboro;" title="{{location.BuildingName}}">{{location.SimpleName}}</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <input type="hidden" id="h_XAxis" value="0" />
                            <input type="hidden" id="h_YAxis" value="0" />
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            <button type="button" class="btn btn-primary" data-dismiss="modal" ng-click="SelectPosition(AddModel)">确定</button>
                        </div>
                    </div>
                </div><!-- /.modal-dialog -->
            </div><!-- /.modal -->
            <div class="row">
                <div class="col-md-12">
                    <div class="form-group">
                        <div class="col-sm-6 col-sm-offset-2" ng-show="@ViewBag.IsAdd">
                            <button class="btn-primary btn" ng-click="AddHiddenTroubleForm(AddModel,SolutionModel,'HiddenTroubleRectification');">提交</button>
                            <a href="HiddenTroubleAdd" class="btn-default btn">重置{{IsAdd}}</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>


@section Js{
    <script src="~/Assets/js/pg/HiddenTrouble.js?v=@DateTime.Now.ToString("yyMMddHHmmss")"></script>
    <script src="~/Assets/js/libs/moment.min.js"></script>
    <script src="~/Assets/js/libs/locales/date/zh-cn.js"></script>
    <script src="~/Assets/js/libs/bootstrap-datetimepicker.min.js"></script>
    <script src="~/Assets/js/libs/angularjs-datepicker.js"></script>
    <script src="~/Assets/js/libs/fileinput.js"></script>
    <script src="~/Assets/js/libs/zh.js"></script>
    <script>
        $('#docfiles').fileinput({
            language: 'zh'
        });
        $("#mapContent").mousedown(function (e) {
            var width = $("#mapContent").width();
            var height = $("#mapContent").height();
            mouseX1 = (e.pageX - $("#mapContent").offset().left) / width;
            mouseY1 = (e.pageY - $("#mapContent").offset().top) / height;
            $("#location").css({ 'left': mouseX1 * 100 + '%', 'top': mouseY1 * 100 + '%' });
            $("#h_XAxis").val(mouseX1);
            $("#h_YAxis").val(mouseY1);
        });
    </script>
}

